#!/bin/bash
set -e
echo "[Remote] Starting deployment for code2law..."
cd /bak/tar
echo "[Remote] Loading Docker image from tar file..."
docker load -i code2law.tar
echo "[Remote] Stopping and removing old container..."
docker stop code2law 2>&1 || true
docker rm code2law 2>&1 || true
echo "[Remote] Pruning old images..."
docker image prune -f 2>&1 || true
echo "[Remote] Starting new container with configured command..."
docker run -d --name code2law -p 7642:5000 -v /d/docker/code2law/data:/app/data --restart unless-stopped code2law
echo "[Remote] Deployment completed!"
docker ps | grep code2law
